package com.wang.bootdemo.service.impl;

import com.wang.bootdemo.entity.TypeEntity;
import com.wang.bootdemo.mapper.TypeMapper;
import com.wang.bootdemo.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

@Service
public class TypeServiceImpl implements TypeService {
    @Autowired(required = false)
    private TypeMapper typeMapper;

    @Override
    public List<TypeEntity> selectAll(String condition) {
        return typeMapper.selectAll(condition);
    }

    @Override
    public boolean insertOne(TypeEntity typeEntity) {
        if (typeEntity.getTName() == null || typeEntity.getTName() =="")return false;
        int row = typeMapper.insertOne(typeEntity);
        if (row != 0){
            return true;
        }
        return false;
    }

    @Override
    public boolean delOne(Integer id) {
        if (id == null || id == 0)return false;
        int row = typeMapper.delOne(id);
        return row != 0;
    }
}
